<?php
//$idNameListen = $_REQUEST['id'];

session_start();
$idListenCurrent = $_SESSION["idListenCurrent"];
$numberObject = $_SESSION["numberObject"];
$idBeginListen = $_SESSION["idBeginListen"];

$resultListen = new Listen();
$question = new Question();

if ($idListenCurrent < $idBeginListen + $numberObject - 1) {
    ++$idListenCurrent;
} else {
    $idListenCurrent = $idBeginListen;
}

$_SESSION["idListenCurrent"] = $idListenCurrent;
$resultListen = $resultListen->getListenByID($idListenCurrent);
$listQuestion = $question->loadQuestionByListen($idListenCurrent);
?>

<div class = "topic_video" id ="contentListen"> <!-- khung ghi đề bài -->
    <div id="NameListListen">
        <?php
        $nameTest = 0;

        for ($i = $idBeginListen; $i < $numberObject + $idBeginListen; $i++) {

            $nameTest++;
            ?>
            <a href="#"   onclick='ClickNameListen(<?php echo $i; ?>);'
            <?php
            if ($idListenCurrent == $i) {
                ?>           
                   style="color:red;"
                   <?php
               }
               ?>

               >Test <?php echo $nameTest; ?></a>
               <?php
           }
           ?>    
    </div> <!-- end namelistlisten -->

    <div class="left_video">
        <video width="320" height="240" controls="controls">
            <source src="<?php echo (elgg_get_site_url() . $resultListen->Video); ?>" type="video/mp4"/>
        </video>
        <br />
        <?php ?>

        <p >View Transcript: 
            <a href="#" onclick='ClickTranscript(<?php echo $idListenCurrent; ?>);'>English</a>
        </p>
        <div id="ViewTranscript"> </div>
    </div>

    <div class="right_video"> <!-- Phần Câu Trả Lời -->
        <?php
        for ($i = 0; $i < count($listQuestion); $i++) {
            $tempQuestion = new Question();
            $tempQuestion = $listQuestion[$i];
            ?>
            <div id="prompt_text" >
                <div id="question" class="recording-complete">
                    <p>
                        <span class="prompt-number"><?php echo $i + 1; ?></span> 
                        <span class="prompt-content"><?php echo $tempQuestion->Title; ?></span>
                    </p>
                </div>

                <div class="input">  
                    <div class="options" align="left" style="margin-left:30px;">
                        <?php
                        echo elgg_view('input/radio', array('name' => $tempQuestion->ID,
                            'userCheck' => $tempQuestion->Right_Answer,
                            'value' => $tempQuestion->User_Answer, 'options' =>
                            array($tempQuestion->Answer1 => '1',
                                $tempQuestion->Answer2 => '2',
                                $tempQuestion->Answer3 => '3')));
                        ?>

                    </div>
                </div>
            </div>
        <?php } ?>
        <br />
        <input style="float:right" type="submit" name="check_answers" value="Check answers" class="elgg-button elgg-button-submit"/>
        <a style="float:right" href="#" onclick='ClickSkipListen(<?php echo $idListenCurrent; ?>);'>Next </a>
    </div>
</div> <!-- End contentListen -->